package com.hna.face.config;

import javax.validation.constraints.NotNull;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;


@Validated
@Component(value = "sysConfig")
@ConfigurationProperties(prefix = "")
public class SysConfig {
	private final static Logger log = LoggerFactory.getLogger(SysConfig.class);

	@NotNull
	public static String mqttHost;
	
	@NotNull
	public static String mqttUserName;
	
	@NotNull
	public static String mqttPassword;
	
	@NotNull
	public static String mqttTopic;
	
	@NotNull
	public static String mqttClientid;
	

	@NotNull
	public static String mqttWill;
	
	@NotNull
	public static String mqttOnline;
	
	@NotNull
	public static String mqttData;
	
	@NotNull
	public static int mqttConnectionTimeout;
	
	@NotNull
	public static long mqttPeriod;
	
	@NotNull
	public static long mqttInitialDelay;
	
	@NotNull
	public static int mqttKeepAliveInterval;
	
	@NotNull
	public static String photoDir;
	
	@NotNull
	public static String recognizeLabphotoDir;
	
	@NotNull
	public static String sslPath;
	
	
	@Value("${recognizeLabphoto_dir}")
	public   void setRecognizeLabphotoDir(String recognizeLabphotoDir) {
		log.info("recognizeLabphotoDir:"+recognizeLabphotoDir);
		SysConfig.recognizeLabphotoDir = recognizeLabphotoDir;
	}

	@Value("${ssl_path}")
	public  void setSslPath(String sslPath) {
		SysConfig.sslPath = sslPath;
	}
	
	@Value("${mqtt_period}")
	public void setMqttPeriod(long mqttPeriod) {
		SysConfig.mqttPeriod = mqttPeriod;
	}
	@Value("${mqtt_initialDelay}")
	public void setMqttInitialDelay(long mqttInitialDelay) {
		SysConfig.mqttInitialDelay = mqttInitialDelay;
	}

	@Value("${mqtt_connectionTimeout}")
	public void setMqttConnectionTimeout(int mqttConnectionTimeout) {
		SysConfig.mqttConnectionTimeout = mqttConnectionTimeout;
	}

	@Value("${mqtt_keepAliveInterval}")
	public void setMqttKeepAliveInterval(int mqttKeepAliveInterval) {
		SysConfig.mqttKeepAliveInterval = mqttKeepAliveInterval;
	}

	@Value("${mqtt_clientid}")
	public void setMqttClientid(String mqttClientid) {
		SysConfig.mqttClientid = mqttClientid;
	}
	
	@Value("${photo_dir}")
	public void setPhotoDir(String photoDir) {
		SysConfig.photoDir = photoDir;
	}
	@Value("${mqtt_will}")
	public void setMqttWill(String mqttWill) {
		SysConfig.mqttWill = mqttWill;
	}
	@Value("${mqtt_online}")
	public void setMqttOnline(String mqttOnline) {
		SysConfig.mqttOnline = mqttOnline;
	}
	@Value("${mqtt_data}")
	public void setMqttData(String mqttData) {
		SysConfig.mqttData = mqttData;
	}

	@Value("${mqtt_host}")
	public void setMqttHost(String mqttHost) {
		SysConfig.mqttHost = mqttHost;
	}
	
	@Value("${mqtt_userName}")
	public void setMqttUserName(String mqttUserName) {
		SysConfig.mqttUserName = mqttUserName;
	}
	
	@Value("${mqtt_passWord}")
	public void setMqttPassword(String mqttPassword) {
		SysConfig.mqttPassword = mqttPassword;
	}
	
	@Value("${mqtt_topic}")
	public void setMqttTopic(String mqttTopic) {
		SysConfig.mqttTopic = mqttTopic;
	}
	

	
}